﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;

namespace WebApplication.Utils
{
    public class HtmlWriter
    {
        protected HtmlWriter()
        { }

        protected static HtmlWriter _instance;
        public static HtmlWriter Create()
        {
            if (_instance == null)
                _instance = new HtmlWriter();

            return _instance;
        }

        private StringBuilder _builder;
        public StringBuilder Builder
        {
            get
            {
                if (this._builder == null)
                    this._builder = new StringBuilder();

                return this._builder;
            }
        }

        public StringBuilder GetWarningMessage(string message)
        {
            return this.Builder.AppendFormat("<div class=\"alert alert-warning\"><button type=\"button\" class=\"close\" data-dismiss=\"alert\">&times;</button>{0}</div>", message);
        }

        public StringBuilder GetDangerMessage(string message)
        {
            return this.Builder.AppendFormat("<div class=\"alert alert-danger\"><button type=\"button\" class=\"close\" data-dismiss=\"alert\">&times;</button>{0}</div>", message);
        }
    }
}